﻿//--------------------------------------------------------------------
// All Rights Reserved , Copyright (C) 2009 , ESSE , Ltd. 
//--------------------------------------------------------------------

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.ServiceProcess;
using System.Text;
using System.Windows.Forms;
using System.Runtime.Remoting;

namespace DotNet.WindowsService
{
    using DotNet.Model;
    using DotNet.Utilities;
    using DotNet.Business;
    using DotNet.Service;

    /// <summary>
    /// CommonService
    /// 
    /// 修改纪录
    ///
    ///		2008.03.06 版本：1.0 JiRiGaLa 创建Windows服务。
    ///		
    /// 版本：1.0
    ///
    /// <author>
    ///		<name>JiRiGaLa</name>
    ///		<date>2007.08.15</date>
    /// </author> 
    /// </summary>
    public partial class CommonService : ServiceBase
    {
        public CommonService()
        {
            InitializeComponent();
        }

        protected override void OnStart(string[] args)
        {
            // 是否记录日志
            BaseSystemInfo.RecordLog = false;
            BaseSystemInfo.StartupPath = Application.StartupPath;
            // 读取配置文件
            // 读取配置文件
            BaseSystemInfo.ConfigurationFrom = ConfigurationCategory.UserConfig;
            BaseConfiguration.GetSetting();

            // 多语言国际化加载
            // ResourceManagerWrapper.Instance.LoadResources(Application.StartupPath + @"\Resource\Localization\");
            // 从当前指定的语言包读取信息
            // AppMessage.GetLanguageResource();

            // 设置数据库中的表配置
            // 主应用程序集名
            BaseSystemInfo.MainAssembly = System.Reflection.Assembly.GetEntryAssembly().GetName().Name;
            RemotingConfiguration.Configure(Application.StartupPath + "\\" + ConfigHelper.FileName);
        }

        protected override void OnStop()
        {
        }
    }
}